<?php

	$current_city_info = get_city_by_url();
	$current_city = $current_city_info['current_city'];
	$current_city_name = $current_city_info['current_city_name'];
	/*$cities_list = array (
		20 => 'Харьков',
		21 => 'Киев',
		41 => 'Одесса',
		57 => 'Керчь'
	);*/
function _draw_events_count_row($p)
{
    if($p->events_count>0)
    {
        //<img id="" title="Есть новые Афиши" src="/themes/epimetheus/images/fav_icon.png" width="60" style="float:right;">
        return '
            <div class="afishe_count">'.$p->events_count.'</div>';
    }
}
?>
<section id="<?php print $block_html_id; ?>" >
	<ul>
    <?php foreach ($block->{'#other_places'} as $c) : ?>

        <h3>Все <?php echo l($c['category']['taxonomy_term']->name.' '.$current_city_name,'places',array('query'=>array('category'=>$c['category']['taxonomy_term']->tid),'attributes'=>array('class'=>'place_cat_lnk'))); ?></h3>

        <?php foreach ($c['places'] as $p) : 
            $title=$p->title;
        //pre($p);
            #if($p->events_count>0)$title.=' <img id="place_with_event" title="Есть новые Афиши" src="/themes/epimetheus/images/fav_icon.png">';
            $class=($p->events_count?'place_contain_events':'');
            ?>
			<?php if ($current_city == 0) {?>
	            <?php  if($block->{'#parent_id'} == $p->nid) { echo '<li class="active">';} else { echo '<li>'; } echo l($title, 'node/' . $p->nid,array('html'=>true,'attributes'=>array('class'=>array($class))))._draw_events_count_row($p);  echo '</li>'; ?>
			<?php } elseif ($current_city == $p->field_place_city_tid) {?>
				<?php echo '<li>'.l($title, 'node/' . $p->nid,array('html'=>true,'attributes'=>array('class'=>array($class))))._draw_events_count_row($p).'</li>'; ?>
			<?php }?>
        <?php endforeach; ?>
		<br/>
    <?php endforeach; ?>
	</ul>
</section>